package cn.agiledata.bank.common.service.email;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Date;
import java.util.Map;

import cn.agiledata.bank.common.service.NotifyMail;
import cn.agiledata.bank.common.util.DateUtil;
import cn.agiledata.bank.common.util.WeatherUtil;
import cn.agiledata.bank.hibernateBean.ScoresHis;
import cn.agiledata.bank.hibernateBean.SubAccount;
import cn.agiledata.bank.hibernateBean.Transaction;

public class FillMoneyDown extends NotifyMail{
	private String warn;
	
	private String mobilewarn;
	
	public String getWarn() {
		return warn;
	}

	public void setWarn(String warn) {
		this.warn = warn;
	}

	
	public String getMobilewarn() {
		return mobilewarn;
	}

	public void setMobilewarn(String mobilewarn) {
		this.mobilewarn = mobilewarn;
	}

	protected SubAccount setMailContext(Map vnvMap, Transaction tran,
			ScoresHis score) {
		SubAccount emailTo = tran.getCredit();
		String now =DateUtil.date2String(new Date());
		String titlemessage ="您于"+now+"进行了线下充值操作：";
		String creditName = WeatherUtil.getNameOrEmailOrMobileByAccount(tran.getCredit().getAccount());
		NumberFormat nf = new DecimalFormat("#0.00#");
	    vnvMap.put("titlemessage", titlemessage);
	    vnvMap.put("offlinetype", getWarn());
	    vnvMap.put("amount", nf.format(tran.getAmount().doubleValue()));
	    vnvMap.put("verifyCode",tran.getVerifyCode());
	    vnvMap.put("name",creditName);
	    vnvMap.put("urlpath", getUrl());
	    vnvMap.put("mobilewarn", getMobilewarn());
		return emailTo;
	}
}
